﻿function Show()
    {
       if(($("sl2").style.display==""&&$("sl3").style.display=="")||($("sl2").style.display==""&&$("sl4").style.display=="")||$("sl4").style.display==""&&$("sl3").style.display=="")
            {
                $("TLanShow").style.display="none";
            }
            if($("sl2").style.display=="none")
            {
                $("sl2").style.display="";
            }
            else if($("sl2").style.display==""&&$("sl3").style.display=="none")
            {
                $("sl3").style.display="";
            }
            else if($("sl2").style.display==""&&$("sl3").style.display==""&&$("sl4").style.display=="none")
            {
                $("sl4").style.display="";
            }
    }
    function del()
    { 
    $("TLanShow").style.display="";
        var j=0;
       for(var i=1 ;i<5;i++)
       {
        if($("sl"+i).style.display=="none")
        {
        
           j=i-1; $("sl"+j).style.display="none";
           $("TLang"+j).value="";
           break;
        }
            if(i==4&&j==0)
            {
                $("TLang4").value="";
                $("sl4").style.display="none";
            }
       }
    }
 //判断选择的行业来显示相对应的
function OccupationCatChange()
{

	var obj1 = document.getElementById("Occupation1");
	var obj2 = document.getElementById("Occupation2");
	var obj=document.getElementById("OccupationCat");
	var selv = obj.value;
	if(selv==""||selv=="3")
	{
		obj1.style.display = 'none';
		obj2.style.display = 'none';
	}
	else if(selv=="1")
	{
		obj1.style.display = 'none';
		obj2.style.display = '';
	}
	else if(selv=="2")
	{
		obj1.style.display = '';
		obj2.style.display = 'none';
	}
}

function getTlevel(a,b)
{
var level="";
   
    if($(a).value!=""&&$(b).value!="")
    {
       level+=""+$(a).value;
    }

    return level;
}

function Tpstep()
{
$('SGender').style.display='none';
if(!$ValidButton$()||($('Gender1').checked==false&&$('Gender2').checked==false))
{ 
if($('Gender1').checked==false&&$('Gender2').checked==false)
{
    $('SGender').style.display='';
    $('Gender').className="validatorCalloutHighlight";
 }

    return;
}
showProgressBar(true);
var MotherTongueLevel=getTlevel('TLle1','TLang1');
var MotherTongue2Level=getTlevel('TLle2','TLang2');
var MotherTongue3Level=getTlevel('TLle3','TLang3');
var MotherTongue4Level=getTlevel('TLle4','TLang4');
var Gender="0";
if($('Gender1').checked)
{
  Gender="1";  
}
var BOD=aa.value;
var IsShowBod=true;
if($('IsShowBod').checked)
{
IsShowBod=false
}
var Occupation="";
if($('OccupationCat').value==1)
{
    Occupation=$get("Occupation2").value;
}
else if($('OccupationCat').value==2)
{
    Occupation=$get("Occupation1").value;
}
 WebServices.User.Teach.AddTeachProfile2(memberno,$('TLang1').value, MotherTongueLevel, $('TLang2').value, MotherTongue2Level, $('TLang3').value, MotherTongue3Level, $('TLang4').value, MotherTongue4Level, $('Nickname').value, $('Nationality').value, $('Hometown').value, $('Country').value, $('City').value, Gender, BOD, IsShowBod, $('Education').value, $('OccupationCat').value, Occupation, $('IMType').value, $('IMValue').value, "", "", "", "",onners);   
 }
function onners(reft)
{
showProgressBar(false);
if(reft)
{
      top.location="/invite_teach/Tpstep3.htm";
}else
{
$get("MessagesBox").style.display='';
}

}